package com.ljx.threadTest.threadEnum;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 李加喜
 * @Package com.ljx.threadTest.config
 * @date 2024-05-29 10:47
 */
@Data
@NoArgsConstructor
public class CustomErrorCode implements ErrorCode {

    /**
     * 应用编码
     */
    private int app;

    /**
     * 模块编码
     */
    private int module;

    /**
     * 错误码
     */
    private int code;

    /**
     * 错误信息
     */
    private String name;


    public static CustomErrorCode wrapper(BaseErrorCode errorCode) {
        return new CustomErrorCode(errorCode.getCode(), errorCode.getName());
    }

    public CustomErrorCode(int app, int module, int code, String name) {
        this.app = app;
        this.module = module;
        this.code = code;
        this.name = name;
        check();
    }

    public CustomErrorCode(int module, int code, String name) {
        this.module = module;
        this.code = code;
        this.name = name;
        check();
    }

    public CustomErrorCode(int code, String name) {
        this.code = code;
        this.name = name;
        check();
    }
}
